package jinyilw.swing.i18n;

import java.awt.Component;

/**
 * @author Jinyi
 */
public interface LanguageChanger
{

	 void setICSetting(ICSetting iSetting);

	 ICSetting getICSetting();

	 void updateText(String text);

	// public void updateFont(Font font);

	default boolean needChangLanguage()
	{
		ICSetting i18nSetting = getICSetting();
		return i18nSetting != null && i18nSetting.needChange();
	}

	default void changLanguage()
	{
		ICSetting i18nSetting = getICSetting();
		if (i18nSetting != null)
			i18nSetting.changText(this);
	}

	default void setText(ICSetting iSetting)
	{
		setICSetting(iSetting);
		if (iSetting != null)
			iSetting.updateText(this);
	}

	default void setText(ICSetting iSetting, boolean zoomOutEN)
	{
		setICSetting(iSetting);
		if (iSetting != null)
		{
			iSetting.setZoomOutEN((Component) this);
			iSetting.updateText(this);
		}
	}

	default void setReplaceData(Object... replaceData)
	{
		ICSetting i18nSetting = getICSetting();
		if (i18nSetting != null)
			i18nSetting.setReplaceData(this, replaceData);
	}
}
